package luj.tool.jnproxyan.proxy.network.socks.actor.root.message.request.init.refuse33;

import luj.tool.jnproxyan.proxy.network.socks.actor.root.Socks5Actor;
import luj.tool.jnproxyan.proxy.network.socks.request.RequestBody;
import luj.tool.jnproxyan.proxy.network.socks.request.SocksRequest;
import luj.tool.jnproxyan.proxy.network.socks.request.op.RequestByIdGetter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
final class OnReqDeny33Auth implements Socks5Actor.Handler<ReqDeny33AuthMsg> {

  @Override
  public void onHandle(Context ctx) throws Exception {
    Socks5Actor self = ctx.getActorState(this);
    ReqDeny33AuthMsg msg = ctx.getMessage(this);

    RequestBody body = new RequestBody();
    body.setVersion(msg.version());
    body.setMethods(msg.methods());

    SocksRequest req = _reqGetter.inject(self, msg.reqId()).getReq();
    req.setBody(body);
    req.setStatus("2.无可用验证");
  }

  @Autowired
  RequestByIdGetter _reqGetter;
}
